package com.feicheng.controller.shop.admin.client;


import com.alibaba.fastjson.JSONObject;
import com.feicheng.common.constant.Constant;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.persistence.model.DepositBackRequestMain;
import com.feicheng.service.IFClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cailongyang
 * @since 2021-12-02
 */
@RestController("/shop/admin/client/deposit-back-request")
@RequestMapping("/shop/admin/client/deposit-back-request")
public class DepositBackRequestController {

    @Autowired
    IFClientService clientService;

    @GetMapping("/page")//门店分页查退押记录
    public ResultInfo getDepositBackRequestByPage(
            @RequestParam(defaultValue="1") Integer currentPage,
            @RequestParam(defaultValue="10") Integer pageSize,
            String clientName,
            String statu,
            String storeId
    ){

        JSONObject param = new JSONObject();
        param.put(Constant.ENTITY.STORE.STORE_ID,storeId);
        param.put(Constant.HTTP.PARAM.CURRENT,currentPage);
        param.put(Constant.HTTP.PARAM.SIZE,pageSize);
        param.put(Constant.ENTITY.DEPOSIT_BACK_REQUEST.STATU,statu);
        param.put(Constant.ENTITY.CLIENT.CLIENT_NAME,clientName);
        return clientService.getDepositBackRequestByPage(param);
    }
    
    @GetMapping("/list")
    public ResultInfo getDepositBackRequestAll(
    	Integer clientId,
    	Integer storeId,
    	Integer depositId
    		) {

		JSONObject param = new JSONObject();
		param.put(Constant.ENTITY.STORE.STORE_ID, storeId);
		param.put(Constant.ENTITY.CLIENT.CLIENT_ID, clientId);
		param.put(Constant.ENTITY.DEPOSIT_RECORD.DEPOSIT_ID, depositId);
		
    	return clientService.getDepositBackRequestAll(param);
    }
    
    
    
    @GetMapping("/info")//查退押记录详情
    public ResultInfo getDepositBackRequest(Integer backId) {
        return clientService.getDepositBackRequest(backId);
    }

}
